#ifndef _WIFI_CONTROLLER_H
#define _WIFI_CONTROLLER_H

#include <AsyncTimer.h>

#include "WiFi.h"
#include "WiFiSetting.h"

class WifiAsyncConnect {
private:
    static unsigned short timer_id;
    static bool is_wifi_open;
    static bool is_all_wifi_checked;
    static bool is_wifi_success;
    static bool is_finished;
    static uint8_t current_wifi;
    static uint8_t count;

    static void callback();

public:
    static bool is_timer_checked;

    WifiAsyncConnect();

    virtual ~WifiAsyncConnect() = default;

    struct WifiInfo {
        const bool is_static_ip = false;
        const char *ssid{};
        const char *pass{};
        bool is_begin = false;

        WifiInfo(const char *_ssid, const char *_pass) : ssid(_ssid), pass(_pass) {}

        WifiInfo(const char *_ssid, const char *_pass, const bool _static_ip) : ssid(_ssid), pass(_pass), is_static_ip(_static_ip) {}
    };

    static WifiAsyncConnect::WifiInfo wifi_arr[ARRAY_SIZE];

    static void set_wifi_check_callback();

    static void wifi_async_check();

    static void wifi_close();

    static bool get_wifi_status();
};

#endif  //_WIFI_CONTROLLER_H
